<template>
	<view class="my">
		<view class="my-header">
			<image :src="avatarUrl"></image>
			<view>{{nickName}}</view>
		</view>
		<view class="mylist">
			<view class="mylist-view" @click="urlClick('/pages/my/like')">
				<image  class="lefticon" src="../../static/my/xihuan.png"></image>
				<view>喜欢的题</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view>
			<view class="mylist-view" @click="urlClick('/pages/my/record')">
				<image  class="lefticon" src="../../static/my/jilu.png"></image>
				<view>答题记录</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view>
			<view class="mylist-view" @click="urlClick('/pages/my/information')">
				<image  class="lefticon" src="../../static/my/xi.png"></image>
				<view>资料设置</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view>
			<view class="mylist-view" @click="urlClick('/pages/feedback/feedback')">
				<image  class="lefticon" src="../../static/my/fan.png"></image>
				<view>意见反馈</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view>
			<!-- <view class="mylist-view" @click="pluginClick()">
				<image  class="lefticon" src="../../static/my/ping.png"></image>
				<view>评价数独play</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view> -->
			<view class="mylist-view" @click="wxchatClick()">
				<image  class="lefticon" src="../../static/my/wxchat.png"></image>
				<view>用户交流群</view>
				<image class="righticon" src="../../static/icon/right.png"></image>
			</view>
			<button class="sharebutton"  open-type="share">
				<view class="mylist-view" >
					<image  class="lefticon" src="../../static/my/share.png"></image>
					<view>分享好友</view>
					<image class="righticon" src="../../static/icon/right.png"></image>
				</view>
			</button>
			
		</view>
		
		
		<view class="popup" v-if="hide == 1">
			<view class="popup-view" @click="cloneClick()"></view>
			<view class="popup-view2">
				<image class="popup-image" :src="qrcode"  show-menu-by-longpress ="true"></image>
				<view @click="cloneClick()">关闭</view>
			</view>
			
		</view>
		<!-- <view class="qutui">退出</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickName : '',
				avatarUrl :'',
				path:'/pages/index/index',
				hide : 0,
				qrcode :''
			};
		},
		
		onShow(){
			
			this.getdetails();
		},
		onShareAppMessage() {
		   return {
		         title: '您的朋友向您推荐数独play小程序',
		         path: this.path, // 路径，传递参数到指定页面。
		　　　　  imgUrl: ''     //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支 
		                          // 持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
		    }
		},
		methods:{
			wxchatClick(){
				let that = this;
				that.$api.getCircledetails({'ids':3}).then(res=>{
					that.qrcode = res.data.info.qrcode;
					that.hide = 1;
					console.log(res);
				})
			},
			cloneClick(){
				this.hide = 0;
			},
			pluginClick(){
				var plugin = requirePlugin("wxacommentplugin");
				plugin.openComment({
				  success: (res)=>{
				    console.log('plugin.openComment success', res)
				  },
				  fail: (res) =>{
				    console.log('plugin.openComment fail', res)
				  }
				})
			},
			getdetails(){
				let that  =this;
				that.$user.getdetails({}).then(res=>{
					that.nickName  = res.data.user.nickname;
					that.avatarUrl  = res.data.user.avatar;
					
				})
			},
			urlClick(e){
				uni.navigateTo({
					url: e ,
				});
			},
			
		}
	}
</script>

<style lang="less">
	.my {
		width: 750rpx;
		min-height: 100vh;
		background-color: #f6f9f9;
		background-repeat: no-repeat;
		background-image: url('@/static/index/bag.png');
		background-size: 100%;
		.my-header {
			display: flex;
			width: 690rpx;
			margin: auto;
			position: relative;
			top: 52rpx;
			image {
				width: 168rpx;
				height: 168rpx;
				border-radius: 50%;
				border: 4rpx solid #fff;
			}
			view {
				color: #fff;
				font-size: 40rpx;
				padding-left: 37rpx;
				padding-top: 43rpx;
			}
		}		
		.mylist {
			width: 690rpx;
			margin: auto;
			min-height: 400rpx;
			background-color: #fff;
			border-radius: 20rpx;
			margin-top: 78rpx;
			padding-top: 20rpx;
			
			.mylist-view {
				display: flex;
				width: 600rpx;
			    margin: auto;
			    height: 102rpx;
				line-height: 100rpx;
				.lefticon {
					width: 50rpx;
					height: 50rpx;
					padding-top: 26rpx;
				}
				.righticon {
					width: 38rpx;
					height: 46rpx;
					margin-left: auto;	
					padding-top: 28rpx;
				}
				view {
					color: #333;
					padding-left: 24rpx;
					font-size: 28rpx;
				}
			}
		}
		.qutui {
			line-height: 100rpx;
			background-color: #fff;
			color: #333;
			width: 690rpx;
			margin: auto;
			margin-top: 30rpx;
			border-radius: 20rpx;
			text-align: center;
		}
		
	}
</style>
